<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:constants="http://www.tuanzi.com/constants/tags">

<p:dialog header="发票信息" widgetVar="billing" modal="true" closable="true" resizable="true" style="position: absolute;">
    <p:outputPanel id="bill-info-dialog">
        <div class="ui-g-12 ui-fluid" style="width:1000px;">
            <p:panelGrid columns="4" layout="grid"
                         columnClasses="ui-grid-col-1,ui-grid-col-5,ui-grid-col-1,ui-grid-col-5"
                         styleClass="ui-panelgrid-blank"
                         style="border:0px none; background-color:transparent;text-align:left;">
                <p:outputLabel value="主体名称"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.companyName}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="开票内容"/>
                <p:selectOneMenu id="billContent" value="#{xhhSettlementBillListBean.settlementBill.billContent}"
                                 disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}">
                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                  noSelectionOption="true"/>
                    <f:selectItems
                            value="#{xhhSettlementBillListBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILLING_CONTENT]}"
                            var="dic"
                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                </p:selectOneMenu>

                <p:outputLabel value="登记税号"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.taxNumber}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="发票类型"/>
                <p:selectOneMenu id="billType" value="#{xhhSettlementBillListBean.settlementBill.billType}"
                                 disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}">
                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                  noSelectionOption="true"/>
                    <f:selectItems
                            value="#{xhhSettlementBillListBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILL_TYPE]}"
                            var="dic"
                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                </p:selectOneMenu>

                <p:outputLabel value="开户账户"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.bankAccount}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="开户支行"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.bankAddress}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="开户卡号"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.bankNumber}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="开票地址"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.billAddress}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="开票电话"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.companyPhone}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="收件人姓名"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.receiveName}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="收件人手机"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.receivePhone}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="收件地址"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.receiveAddress}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>

                <p:outputLabel value="财务审核人"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.checkName}" disabled="true"/>

                <p:outputLabel value="开票金额" style="color: red"/>
                <p:inputNumber value="#{xhhSettlementBillListBean.settlementBill.billAmount}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>
            </p:panelGrid>

            <p:panelGrid columns="2" layout="grid"
                         columnClasses="ui-grid-col-1,ui-grid-col-11"
                         styleClass="ui-panelgrid-blank"
                         style="border:0px none; background-color:transparent;text-align:left;">
                <p:outputLabel value="备注"/>
                <p:inputText value="#{xhhSettlementBillListBean.settlementBill.remark}" disabled="#{xhhSettlementBillListBean.settlementBill.billStatus==3}"/>
                <p:commandButton value="保存" icon="fa fa-save"
                                 actionListener="#{xhhSettlementBillListBean.onSave}"
                                 rendered="#{xhhSettlementBillListBean.settlementBill.billStatus!=3}"
                                 update="@form"/>
            </p:panelGrid>
            <div class="ui-g-12 padding0">
                <h2 style="font-weight: bold">
                    <h:outputText value="预付明细" rendered="#{xhhSettlementBillListBean.settlementBill.recordType==1}"/>
                    <h:outputText value="消耗明细" rendered="#{xhhSettlementBillListBean.settlementBill.recordType==2}"/>
                </h2>
                <hr style="color: transparent"/>
            </div>

            <div class="ui-g-12 padding0">
                <p:dataTable var="record" value="#{xhhSettlementBillListBean.incomeList}"
                             rendered="#{xhhSettlementBillListBean.settlementBill.recordType==2}">
                    <p:column headerText="开始时间" style="text-align:center;">
                        <h:outputText value="#{record.startTime}">
                            <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="结束时间" style="text-align:center;">
                        <h:outputText value="#{record.endTime}">
                            <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="产品名称" style="text-align:center;">
                        <h:outputText value="#{record.productName}"/>
                    </p:column>

                    <p:column headerText="推广方式" style="text-align:center;">
                        <h:outputText
                                value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_SETTLEMENT_SPREAD_MODE,record.spreadMode)}"/>
                    </p:column>
                    <p:column headerText="推广渠道" style="text-align:center;">
                        <h:outputText
                                value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_SETTLEMENT_SPREAD_CHANNEL,record.spreadChannel)}"/>
                    </p:column>
                    <p:column headerText="合作模式" style="text-align:center;">
                        <h:outputText
                                value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_COOPERATION_MODE,record.copMode)}"/>
                    </p:column>
                    <p:column headerText="结算方式" style="text-align:center;">
                        <h:outputText
                                value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_SETTLEMENT_CYCLE,record.settlementMode)}"/>
                    </p:column>

                    <p:column headerText="结算单价(元)" style="text-align:center;">
                        <h:outputText value="#{record.priceCpa == null ?'-':record.priceCpa}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="结算单价(%)" style="text-align:center;">
                        <h:outputText value="#{record.priceCps == null?'-':record.priceCps}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="注册数" style="text-align:center;">
                        <h:outputText value="#{record.registerCount == null ?'-': record.registerCount}"/>
                    </p:column>
                    <p:column headerText="放款金额" style="text-align:center;">
                        <h:outputText value="#{record.lendAmount == null ?'-': record.lendAmount}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="点击数" style="text-align:center;">
                        <h:outputText value="#{record.clickCount == null ?'-': record.clickCount}"/>
                    </p:column>
                    <p:column headerText="结算金额" style="text-align:center;">
                        <h:outputText value="#{record.incomeAmount}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="创建人" style="text-align:center;">
                        <h:outputText value="#{record.creator}"/>
                    </p:column>
                </p:dataTable>
                <p:dataTable var="record" value="#{xhhSettlementBillListBean.prepayList}"
                             rendered="#{xhhSettlementBillListBean.settlementBill.recordType==1}">
                    <p:column headerText="充值日期" style="text-align:center">
                        <h:outputText value="#{record.prepayTime}">
                            <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="主体名称" style="text-align:center;">
                        <h:outputText value="#{record.companyName}"/>
                    </p:column>

                    <p:column headerText="付款方式" style="text-align:center;">
                        <h:outputText
                                value="#{xhhSettlementBillListBean.translate(DictionaryCode.XHH_SETTLEMENT_PAY_MODE,record.payMode)}"/>
                    </p:column>

                    <p:column headerText="充值金额" style="text-align:center;">
                        <h:outputText value="#{record.prepayAmount}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="付款账户" style="text-align:center;">
                        <h:outputText value="#{record.payName}"/>
                    </p:column>

                    <p:column headerText="付款账号" style="text-align:center;">
                        <h:outputText value="#{record.payAccount}"/>
                    </p:column>

                    <p:column headerText="创建人" style="text-align:center;">
                        <h:outputText value="#{record.creator}"/>
                    </p:column>
                </p:dataTable>
            </div>
            <div class="ui-g-12 padding0">
                <hr style="color: transparent"/>
            </div>
        </div>
    </p:outputPanel>
</p:dialog>
</html>
